package com.nidu.demo.user.dto;

import com.nidu.demo.base.BaseTenantCO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;
import java.util.Set;

/**
 * 用户客户端对象
 *
 * @author auto
 */
@Data
@Schema(description = "用户客户端对象")
@EqualsAndHashCode(callSuper = true)
public class UserCO extends BaseTenantCO {
    /**
     * 主键ID
     */
    @Schema(description = "主键ID", example = "主键ID")
    private Long id;

    /**
     * 用户名
     */
    @Schema(description = "用户名", example = "admin")
    private String username;

    /**
     * 昵称
     */
    @Schema(description = "昵称", example = "管理员")
    private String nickname;

    /**
     * 手机号
     */
    @Schema(description = "手机号", example = "13800138000")
    private String mobile;

    /**
     * 邮箱
     */
    @Schema(description = "邮箱", example = "admin@example.com")
    private String email;

    /**
     * 头像
     */
    @Schema(description = "头像")
    private String avatar;

    /**
     * 性别
     */
    @Schema(description = "性别")
    private Integer gender;

    /**
     * 公司ID
     */
    @Schema(description = "公司ID", example = "1")
    private Long companyId;

    /**
     * 部门ID列表
     */
    @Schema(description = "部门ID列表", example = "[1,2]")
    private Set<Long> deptIds;

    /**
     * 职位ID列表
     */
    @Schema(description = "职位ID列表", example = "[1,2]")
    private Set<Long> postIds;

    /**
     * 登录IP
     */
    @Schema(description = "登录ip", example = "10.81.10.1")
    private String loginIp;

    /**
     * 登录时间
     */
    @Schema(description = "登录时间", example = "2025-01-01")
    private LocalDateTime loginTime;

    @Schema(description = "排序号", example = "0")
    private Integer sortOrder;

    @Schema(description = "状态(0:禁用,1:启用)", example = "1")
    private Integer status;

    public void setProfile(Set<Long> deptIds, Set<Long> postIds) {
        this.setDeptIds(deptIds);
        this.setPostIds(postIds);
    }
}